Robot-position detecting device and robot system

ABSTRACT

A robot-position detecting device includes: a position-data acquiring unit that acquires position data indicating actual positions of a robot; a position-data input unit that receives the position data output from the position-data acquiring unit; and a position calculating unit that calculates a computational position of the robot through linear interpolation using first and second position data input to the position-data input unit at different times.

BACKGROUND

1. Technical Field

The present invention relates to a robot-position detecting device thatdetects the position of a robot and a robot system including therobot-position detecting device.

2. Related Art

There are known methods for correcting a target position of a robot thatgrips a workpiece. For example, in Japanese Patent No. 4539685, an imagepickup apparatus, which picks up an image of a workpiece, and a robotare respectively moved to predetermined positions such that theworkpiece gripped by a robot and a reference mark provided in the robotare arranged in an image pickup area of the image pickup apparatus. Theimage picked up by the image pickup apparatus is subjected to imageprocessing, whereby a center coordinate, a tilt, and the like of theworkpiece with respect to the reference mark are acquired. A positioncorrection amount concerning a target position of the robot iscalculated on the basis of the acquired center coordinate and the like.

In the method disclosed in Japanese Patent No. 4539685, it is possibleto accurately calculate the position correction amount concerning thetarget position of the robot. However, the robot needs to be stoppedwhen the image for calculating the position correction amount is pickedup. Since the robot is stopped to calculate the position correctionamount in a predetermined position, the throughput of the apparatusdecreases by an amount equivalent to the time in which the robot isstopped. To suppress such a decrease in the throughput, it is desirableto pick up an image of a moving a workpiece without stopping the robotand to acquire the position correction amount of the robot on the basisof the position of the robot at the time of the image pickup and thepicked-up image of the workpiece.

On the other hand, data from an encoder indicating the position of therobot is usually input to a robot controller through serialcommunication. Therefore, the data is input to the robot controller at atime that is later than a time of the output of the data by acommunication time between the encoder and the robot controllercorresponding to a communication period, a data amount, and the like ofthe serial communication. When the data is input, if the robot isconstantly moving as explained above, a position calculated based on theencoder and a position obtained from the image are different from eachother on a time axis.

SUMMARY

An advantage of some aspects of the invention is to provide arobot-position detecting device and a robot system that can improve theaccuracy of the position of a moving robot.

An aspect of the invention is directed to a robot-position detectingdevice including: a position-data input unit to which position dataindicating the position of a robot is input from an encoder; and aposition calculating unit that acquires the input position data andcalculates the position of the robot. The position calculating unitreceives a command for detecting the position of the robot, calculates,using first position data acquired at a first timing earlier than thecommand, second position data acquired at a second timing later than thecommand, and a communication time required for communication between theencoder and the position-data input unit, a position at a timing laterthan a timing of the input of the command by the communication timethrough linear interpolation of the first position data and the secondposition data, and outputs a result of the calculation as the positionof the robot at the time the command is input.

With the robot-position detecting device, the position of the robot isoutput by the linear interpolation on the basis of the timing later thanthe timing of the input of the command by the communication timerequired for the communication between the encoder and the position-datainput unit. Therefore, timings of data used in the linear interpolationare substantially equal timings on a time axis. Therefore, the positionof the robot calculated by the linear interpolation using the firstposition data and the second position data is a position obtained bycorrecting a moving distance of the robot using the communication time.Consequently, it is possible to accurately detect the position of themoving robot.

The robot-position detecting device may be configured such that theposition calculating unit includes a command detecting unit that detectsthe command at a period Ts shorter than a predetermined period T foracquiring the position data input to the position-data input unit fromone encoder.

With the robot-position detecting device described above, the times whenthe command can be detected are more than the times when position dataare input from the one encoder. As a result, it is possible to detectthe position of the robot at time closer to the timing of the input ofthe command.

The robot-position detecting device may be configured such that theposition calculating unit acquires position data from different encodersat periods T/n obtained by equally dividing the predetermined period Tby an integer n equal to or larger than 1 and outputs, for each of theencoders, the position of the robot at the time the command is input.

With the robot-position detecting device described above, the positionof the robot is calculated for each of the different encoders.Therefore, it is possible to more accurately detect the position of therobot at the time the command is input.

The robot-position detecting device may be configured such that theposition calculating unit determines whether the acquired position datais normal, and when the position calculating unit determines that theposition data immediately before the detection of the command is notnormal, the position calculating unit uses, as the first data, positiondata acquired immediately before the not normal position data wasacquired.

Since the position data input from the encoder is an electric signal, itis likely that the position data is affected by noise or the like. Ifthe position of the robot is calculated using position data affected bynoise or the like, the reliability of the position of the robotcalculated by the position calculating unit is deteriorated. In thisregard, with the robot-position detecting device having theconfiguration explained above, the position calculating unit determineswhether the acquired position data is normal and, when it is determinedthat the position data immediately before the detection of the commandis not normal, the position calculating unit uses, as the first positiondata, position data acquired immediately before the not normal positiondata was acquired. Therefore, it is possible to calculate the positionof the robot using normal position data.

The robot-position detecting device may be configured such that, whenthe position calculating unit determines that the position dataimmediately after the detection of the command is not normal, theposition calculating unit uses, as the second position data, positiondata acquired immediately after the not normal position data wasacquired.

Usually, as the first timing and the second timing are temporally farapart from each other, the linearity in positions between the timings isfurther lost. In the robot-position detecting device, since linearinterpolation is used, as the first timing and the second timing aretemporally far apart from each other, a larger error can occur betweenthe position of the robot calculated by the position calculating unitand the actual position of the robot. In this regard, with theconfiguration explained above, for example, when a timing of the inputof the position data, which is a timing immediately after the detectionof the command, is set as a reference timing, even if the first timingand the second timing are temporally furthest apart from each other, thefirst position data is position data input at a timing immediatelypreceding the reference timing and the second position data is positiondata input at a timing immediately following the reference timing. As aresult, it is possible to improve the accuracy of a calculated positionof the robot as compared with calculating the position of the robot onthe basis of position data acquired earlier than the first timing andposition data acquired later than the second timing.

Another aspect of the invention is directed to a robot system including:a robot that conveys a workpiece; an encoder that outputs position dataindicating the position of the robot; a command output unit that outputsa command for detecting the position of the robot; and a robot-positiondetecting unit that receives the input of the position data and thecommand and detects, on the basis of the position data, the position ofthe robot at the time the command is input. The robot-position detectingunit is the robot-position detecting device.

With the robot system according to this aspect of the invention, even ifthe command output unit outputs a command during movement of the robot,it is possible to accurately detect the position of the robot.

The robot system may further include: a camera that picks up, at a timewhen the command is input from the command output unit, an image of apredetermined image pickup range that includes the workpiece as it isbeing moved by the robot; a workpiece-position acquiring unit thatacquires the position of the workpiece on the basis of the imageacquired by the camera; and a target-position correcting unit thatcorrects the target position on the basis of the position of theworkpiece acquired by the workpiece-position acquiring unit and theposition of the robot detected by the robot-position detecting unit.

With the robot system described above, it is possible to correct thetarget position of the robot on the basis of a relative position of theposition of the robot and the position of the workpiece at the timingwhen the command is input from the command output unit. As explainedabove, the position of the robot detected by the robot-positiondetecting unit is a position detected while the robot is being moved. Assuch, the accuracy of the position determination is improved. In otherwords, it is unnecessary to stop the robot in order to correct thetarget position. It is also possible to improve the accuracy of acorrection amount for the target position of the robot. As a result, itis possible to convey, while suppressing a decrease in the throughput ofthe robot system, the workpiece to a position to where the workpieceshould be conveyed.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be described with reference to the accompanyingdrawings, wherein like numbers reference like elements.

FIG. 1 is a perspective view showing a schematic configuration of arobot system according to an embodiment of the invention.

FIG. 2 is a front view showing a front structure of a robot.

FIG. 3 is a functional block diagram showing a system configuration of arobot system.

FIG. 4 is a timing chart showing timings when position data of encodersare acquired.

FIG. 5 is a diagram showing data stored by a storing unit of a dataprocessing unit.

FIG. 6 is a diagram in which the position of the robot is associatedwith time and is an explanatory diagram for conceptually explaining acalculation process for calculating the position of the robot.

FIG. 7 is a flowchart showing a procedure of processing for calculatingthe position of the robot.

FIG. 8 is a flowchart showing the procedure of the processing forcalculating the position of the robot.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

A robot-position detecting device and a robot system according to anembodiment of the invention are explained below with reference to FIGS.1 to 8. First, a schematic configuration of the robot system accordingto the embodiment is explained with reference to FIGS. 1 and 2.

As shown in FIG. 1, in a robot system 10, on a side of a conveyor 11that conveys a workpiece W along a conveying direction Cv atpredetermined conveying speed, a robot 12 of a horizontal multi-jointtype that selectively grips the workpiece W conveyed by the conveyor 11and performs predetermined work is arranged. A camera 13 is set on anupstream side of the robot 12 in the conveying direction Cv. The camera13 picks up, from above, an image of the workpiece W conveyed on theconveyor 11. In the robot system 10, the workpiece W is selected as aworkpiece target on the basis of the image picked up by the camera 13.The position of the workpiece W selected as the workpiece target isobtained on the basis of the image and an encoder 14 that measures aconveyance amount of the conveyor 11. The workpiece W selected as theworkpiece target is carried to a predetermined position on a workbench15 located in a movable range of the robot 12. To accomplish this, theworkpiece W is lifted to predetermined height by the robot 12.

As shown in FIG. 2, in the robot 12, a base shaft 22 that is pivotablewith respect to a base 21 about a control axis C1 extending along thevertical direction is provided at the upper end of the base 21 set on afloor surface or the like. A first motor 23 provided in the base 21 isforwardly and reversely rotated, whereby the base shaft 22 pivots aboutthe control axis C1.

The proximal end of a first horizontal arm 24 extending in thehorizontal direction is coupled and fixed to the base shaft 22. Asupporting shaft 25 is coupled and fixed to the distal end of the firsthorizontal arm 24. The supporting shaft 25 supports a second horizontalarm 26 to be pivotable with respect to the supporting shaft 25 about acontrol axis C2 extending along the vertical direction.

A second motor 27 is disposed at the proximal end of the secondhorizontal arm 26. The second motor 27 forwardly and reversely rotatesto thereby receive reaction from the supporting shaft 25. The secondhorizontal arm 26 pivots, with the reaction, in the horizontal directionwith respect to the first horizontal arm 24 about the control axis C2.

An up-down rotating shaft 29 that pierces through the second horizontalarm 26 is provided at the distal end of the second horizontal arm 26.The up-down rotating shaft 29 is supported to be rotatable with respectto the second horizontal arm 26 and movable in the up and downdirections. A hoisting motor 30 provided in the second horizontal arm 26is forwardly and reversely rotated, whereby the up-down rotating shaft29 is lifted and lowered along a control axis C3 extending in thevertical direction. A rotation motor 31 provided in the secondhorizontal arm 26 is forwardly and reversely rotated, whereby theup-down rotating shaft 29 is forwardly and reversely rotated about acontrol axis C4 thereof extending along the vertical direction. A toolsuch as a hand that grips an object to be conveyed or a hand thatmachines an object to be machined can be attached to a workpiece section32 of the up-down rotating shaft 29.

A detection sensor 35 that detects that the workpiece W passes adetection line FL is provided in a conveying path for the workpiece Wconveyed to the workbench 15. The detection sensor 35 includes a lightemitting unit 36 that emits detection light LB, which is formed by alaser beam having high directivity and convergence, along the horizontaldirection and a light receiving unit 37 that receives the detectionlight LB emitted from the light emitting unit 36. The light emittingunit 36 and the light receiving unit 37 are set to hold the movablerange of the robot 12 between the units and such that the detectionlight LB is temporarily blocked by the workpiece W conveyed from theconveyor 11 to the workbench 15.

A camera 39 that picks up an image of the workpiece W from below at thesame time as the detection of the workpiece W by the detection sensor 35is provided on the lower side of the detection sensor 35. In the robotsystem 10, a relative position of the workpiece W with respect to therobot 12 is obtained on the basis of the image picked up by the camera39 and the position of the robot 12 at the time of the image pickup. Atarget position of the robot 12 is corrected to convey the workpiece Wto a predetermined position set in advance.

A system configuration of the robot system 10 having the configurationexplained above is explained with reference to FIGS. 3 to 8.

As shown in FIG. 3, the robot system 10 is collectively controlled bythe controller 50. The controller 50 is a control device that controlsto drive the robot 12. The controller 50 controls a positioning actionof the robot 12 to move to the target position and controls a trackingaction of the robot 12 to track the workpiece W moving on the conveyor11.

In the controller 50, robot data indicating, for example, the structureand action characteristics of the robot 12 and an area in the movablerange of the robot 12, which is a tracking area where the robot 12 cantrack the workpiece W on the conveyor 11, is set in advance. Further,data concerning various positions indicating, for example, a relativeposition of the conveyor 11 and the robot 12, a relative position of theconveyor 11 and the camera 39, and a relative position of the robot 12and the camera 39, workpiece data indicating the type and the shape ofworkpiece, and the like are set in the controller 50. The robot data,the data concerning the various positions, and the workpiece data areused for the driving control of the robot 12.

The controller 50 includes a user-program storing unit 51 that stores auser program and a user-program executing unit 52 that executes the userprogram stored in the user-program storing unit 51. The controller 50further includes a workpiece-position storing unit 53 that stores aninitial position of the workpiece W recognized by the camera 13 and aworkpiece-position updating unit 54 that calculates a present positionof the workpiece W, the initial position which is stored in theworkpiece-position storing unit 53, on the basis of a moving distance ofthe conveyor 11. The controller 50 further includes a command-valuegenerating unit 55 that generates a track of the workpiece section 32(joint angles on the control axes C1 to C4), converts the track into amotor command value (a pulse), and outputs the motor command value to amotor control unit 57 explained later. Furthermore, the controller 50includes a workpiece-target detecting unit 56 that detects the workpieceW, which is a workpiece target, from a positional relation between thetracking area and the workpiece W and the like and a motor control unit57 that controls the motors 23, 27, 30, and 31 on the control axes C1 toC4 according to the motor command value from the command-valuegenerating unit 55.

The user program stored in the user-program storing unit 51 (e.g.,memory) is a computer program for executing various kinds of processingnecessary for moving the workpiece section 32 of the robot 12 to trackthe workpiece W set as the workpiece target. Further, the user programis a computer program for executing various kinds of processingnecessary for moving the workpiece W gripped by the workpiece section 32to the predetermined position on the workbench 15.

The user-program executing unit 52 executes the user program. Theuser-program executing unit 52 treats, as a workpiece target, theworkpiece W detected as the workpiece target from a detection result ofthe workpiece-target detecting unit 56. Further, the user-programexecuting unit 52 calculates information necessary for causing the robot12 to, for example, track the selected workpiece W, calculatesinformation necessary for moving the robot 12 to the target position,and communicates the calculated data to the command-value generatingunit 55.

The position of the workpiece W being conveyed from a workpiece-positionacquiring unit 58 explained later is input to the user-program executingunit 52 functioning as a target-position correcting unit. The positionof the moving robot 12 calculated by a position calculating unit 60 isalso input to the user-program executing unit 52. The user-programexecuting unit 52 corrects the target position of the robot 12 on thebasis of the position of the workpiece W input from theworkpiece-position acquiring unit 58 and the position of the robot 12input from the position calculating unit 60, calculates informationnecessary for moving the robot 12 to the corrected target position, andcommunicates the calculated data to the command-value generating unit55.

The workpiece-position updating unit 54 calculates the initial positionof the workpiece W from the image of the workpiece W on the conveyor 11picked up by the camera 13 and stores information concerning the initialposition in the workpiece-position storing unit 53. On the other hand,the workpiece-position updating unit 54 calculates a conveying distanceof the workpiece W by the conveyor 11 on the basis of the number ofconveyor pulses obtained by integration of conveyor pulses input fromthe encoder 14. The workpiece-position updating unit 54 calculates adifference between the number of conveyor pulses during the image pickup(in the initial position) of the workpiece W and a present number ofconveyor pulses and calculates a conveying distance from the initialposition of the workpiece W according to a product of the differencebetween the numbers of pulses and a conveying distance per unit conveyorpulse set in advance. The workpiece-position updating unit 54 isconfigured to be capable of sequentially calculating the presentposition of the workpiece W conveyed on the conveyor 11 by adding theconveying distance of the workpiece W calculated as explained above tothe initial position (a coordinate in an X axis direction) of theworkpiece W calculated during the image pickup stored in theworkpiece-position storing unit 53.

The workpiece-target detecting unit 56 compares the present position ofthe workpiece W and the tracking area at a predetermined executionperiod. When the present position of the workpiece W reaches (enters)the tracking area, the workpiece-target detecting unit 56 detects theworkpiece W as the workpiece target. When the present position of theworkpiece W exits the tracking area, the workpiece-target detecting unit56 detects the workpiece W excluded from the workpiece target. Theworkpiece-target detecting unit 56 communicates a result of thedetection to the user-program executing unit 52 and the command-valuegenerating unit 55.

The command-value generating unit 55 generates, on the basis of inputvarious data, a track for moving the robot 12 to the target position andcalculates joint angles on the control axes C1 to C4 for the robot 12 tofollow the track. The command-value generating unit 55 outputs the jointangles on the control axes C1 to C4 for causing the robot 12 to followthe track to the motor control unit 57 as target joint angles. In thisembodiment, the motor control unit 57 controls one motor at a controlperiod T and controls the motors at different timings. The motor controlunit 57 according to this embodiment sequentially controls the motors23, 27, 30, and 31 at a period T/n obtained by dividing the controlperiod T by the number of control axes n (n is an integer equal to orlarger than 1, in this embodiment, n=4) and sequentially outputs, at theperiod T/n, power outputs corresponding to the target joint angles ofthe motors output from the motors output from the command-valuegenerating unit 55. Specifically, the controller 50 switches the motors,which are control targets, at the period T/n in the order of the firstmotor 23, the second motor 27, the hoisting motor 30, and the rotationmotor 31.

Further, the controller 50 includes a workpiece-position acquiring unit58 that acquires the position of the workpiece W at the time of thedetection of the workpiece W by the detection sensor 35 and the positioncalculating unit 60 that calculates the position of the robot 12 at thetime of the detection.

The workpiece-position acquiring unit 58 acquires position data of theworkpiece W by subjecting image data input from the camera 39, whichpicks up, from below, an image of the workpiece W reaching the detectionline FL, to image processing. The workpiece-position acquiring unit 58calculates, through the image processing, a coordinate value of thecenter position of the workpiece W in an image pickup range of thecamera 39 and outputs the coordinate value to the user-program executingunit 52.

The camera 39 is electrically connected to the trigger-signal generatingunit 59 functioning as a command output unit. When the trigger signalserving as the command is input from the trigger-signal generating unit59, the camera 39 picks up an image of the image pickup range of thecamera 39 and outputs image data of the picked-up image to theworkpiece-position acquiring unit 58.

When the workpiece W is detected by the detection sensor 35, thetrigger-signal generating unit 59 generates the trigger signal servingas the command. The trigger-signal generating unit 59 outputs thegenerated trigger signal simultaneously to the camera 39 and atrigger-signal input unit 61 explained later.

The position calculating unit 60 functioning as a robot-positiondetecting device and a robot-position detecting unit is explained indetail.

As shown in FIG. 3, the position calculating unit 60 includes thetrigger-signal input unit 61 functioning as a command detecting unit, aposition-data input unit 62, and a data processing unit 63.

The trigger signal output by the trigger-signal generating unit 59 isinput to the trigger-signal input unit 61. The trigger-signal input unit61 detects a state of the trigger signal at a detection period for thetrigger signal. The data processing unit 63 detects, at a detectionperiod Ts (=T/n) obtained by dividing the control period T for themotors by the number of control axes n (in this embodiment, n=4), thestate of the trigger signal detected by the trigger-signal input unit61.

A first encoder 64, a second encoder 65, a third encoder 66, and afourth encoder 67 that detect joint angles on the control axes C1, C2,C3, and C4 on the basis of absolute positions of the motors 23, 27, 30,and 31 are connected to the position-data input unit 62. The encoders 64to 67 detect the joint angles corresponding thereto in every half time(=T/2) of the control period T for the motors, which is a communicationtime Td required for communication of the encoders and the position-datainput unit 62 and outputs position data indicating the detected jointangles to the position-data input unit 62.

The position-data input unit 62 includes a determining unit 68 thatdetermines whether input position data is normal. The position-datainput unit 62 associates the position data input from the encoders 64 to67 with a determination result of the determining unit 68 concerning theposition data.

The data processing unit 63 acquires the position data input to theposition-data input unit 62 and the determination result associated withthe position data. If the data processing unit 63 acquires the positiondata corresponding to the respective encoders simultaneously from theposition-data input unit 62, the data processing unit 63 needs to beconfigured to correspond to the position data. It is likely that theconfiguration of the data processing unit 63 is complicated. Therefore,a counter incremented at every period T/n is incorporated in the dataprocessing unit 63. The counter indicates a count value corresponding toa control axis set as a control target. As shown in FIG. 4, the dataprocessing unit 63 sequentially acquires the position data from theencoders 64 to 67 at every control period T such that a control axisindicated by a count value of the counter and a control axiscorresponding to the position data input to the position-data input unit62 match.

The position data from the encoders are input to the position-data inputunit 62 through serial communication in the communication time Td.Therefore, the position data acquired by the data processing unit 63 isposition data indicating a position detected by the encoders at a timingthat is earlier than a timing when the position data are acquired by thecommunication time Td.

As shown in FIG. 5, the data processing unit 63 includes a storing unit70 in which an area for storing various data concerning a joint angle onthe control axis C1, joint angle on the control axis C2, a joint angleon the control axis C3, and a joint angle on the control axis C4 isprovided in advance.

In this embodiment, among the timings when position data from an encoderis input to the position-data input unit 62, the next timing of thedetection of the trigger signal is set as a reference timing in theencoder. In the storing unit 70, an area for storing a first position,which is position data acquired earlier than the reference timing, isprovided for each of the control axes C1 to C4. A first position 73 a isthe position data input from the first encoder 64. A first position 73 bis the position data input from the second encoder 65. A first position73 c is the position data input from the third encoder 66. A firstposition 73 d is the position data input from the fourth encoder 67.Further, in the storing unit 70, an area for storing a second position,which is position data acquired later than the reference timing, isprovided for each of the control axes C1 to C4. A second position 74 ais the position data input from the first encoder 64. A second position74 b is the position data input from the second encoder 65. A secondposition 74 c is the position data input from the third encoder 66. Asecond position 74 d is position data input from the fourth encoder 67.

In the storing unit 70, concerning the position data indicating thefirst position, an area for storing, for each of the control axes C1 toC4, a first flag indicating whether the position data is normal isprovided. A first flag 75 a is associated with the position data inputfrom the first encoder 64. A first flag 75 b is associated with theposition data input from the second encoder 65. A first flag 75 c isassociated with the position data input from the third encoder 66. Afirst flag 75 d is associated with the position data input from thefourth encoder 67. Further, in the storing unit 70, concerning theposition data indicating the second position, an area for storing, foreach of the control axes C1 to C4, a second flag indicating whether theposition data is normal is provided. A second flag 76 a is associatedwith the position data input from the first encoder 64. A second flag 76b is associated with the position data input from the second encoder 65.A second flag 76 c is associated with the position data input from thethird encoder 66. A second flag 76 d is associated with the positiondata input from the fourth encoder 67.

The data processing unit 63 determines, every time the data processingunit 63 acquires position data, whether the position data is normal.When the data processing unit 63 determines at a timing earlier than thereference timing that position data is normal, the data processing unit63 updates the first position to the position data and sets the firstflag to “0”. On the other hand, when the data processing unit 63determines at a timing earlier than the reference timing that positiondata is abnormal, the data processing unit 63 sets the first flag to “1”without updating the first position to the position data. The dataprocessing unit 63 sequentially executes, on the control axes C1 to C4,the update of the first position and the setting of the first flag untilthe trigger signal is detected. When the trigger signal is detected, thedata processing unit 63 stores the first positions and the first flagsat the time of the detection in a predetermined area of the storing unit70 as first timing data 77.

When the data processing unit 63 determines at a timing immediatelyafter the reference timing that position data is normal, the dataprocessing unit 63 updates the second position to the position data andsets the second flag to “0”. On the other hand, when the data processingunit 63 determines at a timing immediately after the reference timingthat position data is abnormal, the data processing unit 63 sets thesecond flag to “1” without updating the second position with theposition data. The data processing unit 63 acquires position data at thenext timing immediately after the reference timing and updates thesecond position to the position data irrespective of whether theposition data is normal. When all the second positions are updated, thedata processing unit 63 stores the second positions and the second flagsin the predetermined area of the storing unit 70 as second timing data78.

In the storing unit 70, an area for storing a detection flag 79indicating whether the trigger signal is detected is provided. When thetrigger signal is detected, the data processing unit 63 sets thedetection flag 79 to “1”. When a calculated position of the robot 12 isoutput to the user program executing unit 52, the data processing unit63 sets the detection flag 79 to “0”.

As shown in FIG. 5, in the storing unit 70, an area for storing controlaxis data 80, which is data indicating a control axis set as a controltarget at the time of the detection of the trigger signal, is provided.The data processing unit stores, on the basis of a count value of thecounter incorporated therein, in the control axis data 80, dataindicated by the control axis at the time of the detection of thetrigger signal. Every time the trigger signal is detected, the dataprocessing unit 63 calculates, on the basis of the first timing data 77,the second timing data 78, and the control axis data 80, joint angles onthe control signals C1 to C4 at the time of the detection of the triggersignal and detects the position of the robot 12.

A calculation method for the position of the robot 12 by the positioncalculating unit 60 is explained with reference to FIG. 6. In FIG. 6,the first position, which is a joint angle at a first timing, isrepresented as Pa, the second position, which is a joint angle at asecond timing, is represented as Pb, and a joint angle at the time ofthe detection of the trigger signal is represented as P(k). Thecommunication time Td in this embodiment is a half time (=T/2) of thecontrol period T for the motors.

When the second timing data 78 is stored, the data processing unit 63selects, for each of the control axes C1 to C4, on the basis of acombination of the first flag and the second flag, one calculationformula out of four calculation formulas set in advance according to thecombination. The data processing unit 63 substitutes the first position,the second position, and a constant k based on the control axis data 80in the selected calculation formula to thereby calculate joint angles onthe control axes C1 to C4 at the time of the detection of the triggersignal. The constant k is a constant determined for each control axis onthe basis of a relation between a control axis set as a calculationtarget and a control axis set as a control target at the time of thedetection of the trigger signal. With the period T/n set as a reference,a period from a timing when the trigger signal is detected until thereference timing is represented as “T/n×k” using the constant k.

For example, when the control target at the time of the detection of thetrigger signal is the control axis C1 (the first motor 23), if thecalculation target is the control axis C2 (the second motor 27), sincethe trigger signal is detected earlier than the reference timingconcerning the second encoder 65 by the “period T/n”, the constant k is“1”. If the calculation target is the control axis C3 (the hoistingmotor 30), since the trigger signal is detected earlier than thereference timing of the third encoder 66 by “2×period T/n”, the constantk is “2”. If the calculation target is the control axis C4 (the rotationmotor 31), since the trigger signal is detected earlier than thereference timing by “3×period T/n”, the constant k is “3”. If thecalculation target is the control axis C1 (the first motor 23), sincethe trigger signal is detected earlier than the reference timing by thecontrol period T, the constant k is “4”.

When both the first flag and the second flag of the control axis set asthe calculation target is “0”, i.e., the first timing and the referencetiming are temporally apart from each other by the “control period T”and the reference timing and the second timing are apart from each otherby the “control period T”, the data processing unit 63 calculates ajoint angle on the control axis at the time of the detection of thetrigger signal using Formula (1) below.

$\begin{matrix}\begin{matrix}{{P(k)} = {{Pa} + {\frac{{Pb} - {Pa}}{T + T} \times \left( {{Td} + T - {\frac{T}{n}k}} \right)}}} \\{= {{Pa} + {\frac{{Pb} - {Pa}}{4} \times \left( {3 - \frac{2k}{n}} \right)}}}\end{matrix} & (1)\end{matrix}$

When the first flag of the control axis set as the calculation target is“0” and the second flag of the control axis is “1”, i.e., the firsttiming and the reference timing are temporally apart from each other bythe “control period T” and the reference timing and the second timingare temporally apart from each other by “2×control period T”, the dataprocessing unit 63 calculates a joint angle on the control axis at thetime of the detection of the trigger signal using Formula (2) below.

$\begin{matrix}\begin{matrix}{{P(k)} = {{Pa} + {\frac{{Pb} - {Pa}}{T + {2T}} \times \left( {{Td} + T - {\frac{T}{n}k}} \right)}}} \\{= {{Pa} + {\frac{{Pb} - {Pa}}{6} \times \left( {3 - \frac{2k}{n}} \right)}}}\end{matrix} & (2)\end{matrix}$

When the first flag of the control axis set as the calculation target is“1” and the second flag of the control axis is “0”, i.e., the firsttiming and the reference timing are temporally apart from each other by“2×control period T” and the reference timing and the second timing aretemporally apart from each other by the “control period T”, the dataprocessing unit 63 calculates a joint angle on the control axis at thetime of the detection of the trigger signal using Formula (3) below.

$\begin{matrix}\begin{matrix}{{P(k)} = {{Pa} + {\frac{{Pb} - {Pa}}{{2T} + T} \times \left( {{Td} + {2T} - {\frac{T}{n}k}} \right)}}} \\{= {{Pa} + {\frac{{Pb} - {Pa}}{6} \times \left( {5 - \frac{2k}{n}} \right)}}}\end{matrix} & (3)\end{matrix}$

When both the first flag and the second flag of the control axis set asthe calculation target are “1”, i.e., the first timing and the referencetiming are temporally apart from each other by “2×control period T” andthe reference timing and the second timing are temporally apart fromeach other by “2×control period T”, the data processing unit 63calculates a joint angle on the control axis at the time of thedetection of the trigger signal using Formula (4) below.

$\begin{matrix}\begin{matrix}{{P(k)} = {{Pa} + {\frac{{Pb} - {Pa}}{{2T} + {2T}} \times \left( {{Td} + {2T} - {\frac{T}{n}k}} \right)}}} \\{= {{Pa} + {\frac{{Pb} - {Pa}}{8} \times \left( {5 - \frac{2k}{n}} \right)}}}\end{matrix} & (4)\end{matrix}$

Specifically, in Formulas (1) to (4), a joint angle at the time of thedetection of the trigger signal is calculated by linear interpolationperformed using position data at the first timing and position data atthe second timing. An amount of change of the joint angle in a period ofthe communication time Td is calculated using a rate of change of thejoint angle based on the linear interpolation. An actual joint angle atthe time of the detection of the trigger signal is calculated by addingup the joint angle at the time of the detection of the trigger signalcalculated by the linear interpolation and the amount of change of thejoint angle in the period of the communication time Td.

More specifically, as shown in FIG. 6, the joint angle Pa is actually ajoint angle at time earlier than the first timing by the communicationtime Td. The joint angle Pb is a joint angle at time earlier than thesecond timing by the communication time Td. Therefore, a straight line81 shown by the linear interpolation indicates a joint angle in a periodearlier than a period until the first timing or the second timing by thecommunication time Td. In other words, a straight line 82 obtained bytranslating the straight line 81 by a distance equivalent to thecommunication time Td indicates a relation between a joint angleacquired according to the first timing and the second timing and anactual timing when the joint angle is embodied. Therefore, since adifference between the straight line 82 and the straight line 81 is anamount of a change of the joint angle equivalent to the communicationtime Td at a rate of change of the joint angle, an actual joint angle atthe time of the detection of the trigger signal is calculated by addingthe amount of change of the joint angle to the joint angle indicated bythe straight line 81. In other words, in the straight line 81 shown bythe linear interpolation using the position data at the first timing andthe position data at the second timing, a joint angle at a time laterthan the time of the detection of the trigger signal by thecommunication time Td is calculated as an actual joint angle at the timeof the detection of the trigger signal.

A procedure of the processing to calculate the position of the robot inthe data processing unit 63 having the configuration explained above isexplained with reference to FIGS. 7 and 8. This processing is repeatedlyexecuted.

As shown in FIG. 7, first, concerning a control axis indicated by acount value of the incorporated counter, the data processing unit 63acquires, as position data at the first timing, position data associatedwith a determination result of the determining unit 68 (step S10).Subsequently, the data processing unit 63 determines, on the basis ofthe position data acquired in step S10, whether the position data isnormal (step S11).

When the data processing unit 63 determines in step S11 that theposition data is normal (YES in step S11), the data processing unit 63sets the first flag to “0” and updates the first position to theposition data (step S12). The data processing unit 63 shifts to the nextstep S14. On the other hand, when the data processing unit 63 determinesin step S11 that the position data is abnormal (NO in step S11), thedata processing unit 63 sets the first flag to “1” and does not updatethe first position (step S13). The data processing unit 63 shifts tostep S14.

In the next step S14, the data processing unit 63 determines whether thetrigger signal is detected at the present detection timing via thetrigger-signal input unit 61.

When the trigger signal is not detected in step S14 (NO in step S14),the data processing unit 63 shifts to step S10 again and acquires, viathe position-data input unit 62, position data at the first timingconcerning a control axis indicated next by a count value of thecounter. In other words, the data processing unit 63 sequentiallyexecutes, on the control axes C1 to C4, the update of the first positionand the setting of the first flag until the trigger signal is detectedin step S14.

When the trigger signal is detected in step S14 (YES in step S14), thedata processing unit 63 sets the detection flag 79 to “1” (step S15).The data processing unit 63 stores, on the basis of a count value of thecounter, in the control axis data 80, data indicating a control axis atthe time of the detection of the trigger signal (step S16). The dataprocessing unit 63 stores data indicating states of the first positionsand the first flags, which are stored at the time of the detection ofthe trigger signal, in the predetermined area of the storing unit 70 asthe first timing data 77 (step S17).

Subsequently, the data processing unit 63 sequentially acquires positiondata of the control axes C1 to C4 at the reference timing (step S18).The data processing unit 63 sequentially acquires, as position data atthe second timing, position data of the control axes at a timingimmediately after the reference timing (step S19).

In the next step S20, the data processing unit 63 determines, on thebasis of the position data acquired at the timing immediately after thereference timing, whether the position data are normal. Concerning thecontrol axis, the acquired position data which is determined as normalin step S20, the data processing unit 63 sets the second flag to “0”(step S21) and then updates the second position to the acquired positiondata (step S24).

On the other hand, in the step S20 concerning the control axis, theacquired position data which is determined as abnormal, the dataprocessing unit 63 sets the second flag to “1” (step S22). The dataprocessing unit 63 acquires position data at the next timing as positiondata at the second timing (step S23). The data processing unit 63updates the second position to the acquired position data whilemaintaining a state of the second flat at “1” (step S24).

As shown in FIG. 8, when the update of the second positions completelyends concerning the control axes C1 to C4, the data processing unit 63stores data indicating states of the second positions and the secondflags in the predetermined area of the storing unit 70 as the secondtiming data 78 (step S25).

When the second timing data 78 is stored, the data processing unit 63checks states of the first and second flags concerning the control axesC1 to C4 (step S26). The data processing unit 63 selects calculationformulas according to the first and second flags. Specifically,concerning the control axis, both the first flag and the second flagwhich are “0” (YES in step S27 and YES in step S28), the data processingunit 63 selects Formula (1) (step S30). Concerning the control axis, thefirst flag which is “0” (YES in step S27) and the second flag which is“1” (NO in step S28), the data processing unit 63 selects Formula (2)(step S31). Concerning the control axis, the first flag which is “1” (Noin step S27) and the second flag which is “0” (YES in step S28), thedata processing unit 63 selects Formula (3) (step S32). Concerning thecontrol axis, both the first flag and the second flag which are “1” (NOin step S27 and NO in step S28), the data processing unit 63 selectsFormula (4) (step S33).

When the calculation formulas are selected for the control axes C1 toC4, the data processing unit 63 substitutes the constant k based on thefirst position, the second position, and the control axis data 80 in theselected formulas (step S34). Consequently, the data processing unit 63calculates the position of the robot 12 indicated by joint angles on thecontrol axes C1 to C4 (step S35). The data processing unit 63 outputsthe calculated position of the robot 12 to the user-program executingunit 52 (step S36) to thereby set the detection flag 79 to “0” and thenonce ends the series of processing.

The action of the robot system 10 having the configuration explainedabove is now explained.

In the robot system 10 having the configuration explained above, theworkpiece W conveyed by the conveyor 11 is selectively gripped by therobot 12. The workpiece W is detected by the detection sensor 35 whenthe workpiece W is being conveyed to the predetermined position on theworkbench 15. In other words, the workpiece W is detected by thedetection sensor 35 when the robot 12 is moved to the target position ofthe robot 12. When the workpiece W is detected, the position of theworkpiece W at the time of workpiece detection is acquired on the basisof image data picked up by the camera 39. An actual position of therobot 12 at the time of the detection is calculated by the positioncalculating unit 60 on the basis of the positions of the robot 12 beforeand after the workpiece detection. The target position of the robot 12is corrected on the basis of the position of the workpiece W and theactual position of the robot 12.

As explained above, with the robot system 10 according to thisembodiment, effects such as those listed below can be obtained.

(1) The position calculating unit 60 according to the embodimentcalculates, concerning each of the control axes, an actual joint angleat the time of the detection of the trigger signal by adding, to a jointangle at the time of the detection of the trigger signal acquired bylinear interpolation using position data at the first timing andposition data at the second timing, an amount of change of a joint anglein the communication time Td calculated using a rate of change of thejoint angle based on the linear interpolation. In other words,concerning the joint angle acquired by the linear interpolationperformed using the position data at the first timing and the positiondata at the second timing, a joint angle at a time later than the timeof the detection of the trigger signal by the communication time Td iscalculated as the actual joint angle at the time of the detection of thetrigger signal. With such a configuration, even during the movement ofthe robot 12, it is possible to accurately detect joint angles on thecontrol axes C1 to C4 at the time of the detection of the triggersignal. In other words, it is possible to accurately detect the positionof the moving robot 12.

(2) The data processing unit 63 of the position calculating unit 60acquires, at different timings, position data concerning a joint angleon the control axis C1, position data concerning a joint angle on thecontrol axis C2, position data concerning a joint angle on the controlaxis C3, and position data concerning a joint angle on the control axisC4. The position calculating unit 60 calculates, concerning the controlaxes C1 to C4, actual joint angles at the time of the detection of thetrigger signal. As a result, the joint angle on the control axis C1, thejoint angle on the control axis C2, the joint angle on the control axisC3, and the joint angle on the control axis C4 are calculated.Therefore, it is possible to highly accurately detect an actual positionof the robot at the time of the detection of the trigger signal.

(3) The position calculating unit 60 determines whether position datainput to the position-data input unit 62 is normal and calculates jointangles on the control axes C1 to C4 using calculation formulas selectedaccording to the determination. Consequently, it is possible to suppressthe position of the robot 12 from being detected according to positiondata affected by a deficiency related to transmission of position datasuch as noise. As a result, it is possible to improve the accuracy ofthe position of the robot 12 detected by the position calculating unit60.

(4) In the robot system, usually, it is extremely rare that the positiondata will continue to be determined to be abnormal. For example,position data is determined as abnormal when a deficiency occurs in acable that connects the position-data input unit 62 and the encoders orin the encoders themselves. Therefore, if special processing isexecuted, for example, when abnormal data are continuously input to theposition-data input unit 62 from the same encoder, a new component forexecuting the processing is separately necessary. It is likely that theconfiguration of the position calculating unit 60 is complicated. Inthis regard, in the embodiment, the position calculating unit 60 isconfigured on the premise that at least one of two continuous positiondata output from the same encoder is normal data. As a result, it ispossible to more simply configure the position calculating unit 60.

(5) Since the position of the robot 12 is calculated using linearinterpolation, as the first timing and the second timing are temporallyfurther apart from each other, a large error may more easily occurbetween a calculated position of the robot 12 and an actual position ofthe robot 12. In this regard, in the position calculating unit 60, evenwhen the first timing and the second timing are temporally furthestapart from each other, first position data is position data input at atiming immediately preceding the reference timing and second positiondata is position data input at a timing immediately following thereference timing. As a result, it is possible to improve the accuracy ofthe calculated position of the robot 12 as compared with the position ofthe robot 12 calculated on the basis of position data acquired earlierthan the first timing and position data acquired later than the secondtiming.

(6) In the embodiment, the communication time Td is set to a half timeof the control period T for the motors and a period at which the dataprocessing unit 63 acquires position data from the encoders is set tothe control period T for the motors. When an output period of theencoders is smaller than the communication time Td, in some case, thesecond timing is a timing earlier than a timing when the communicationtime Td elapses from the reference timing. In such a case, it is likelythat the straight line 82 obtained by translating the straight line 81shown in FIG. 6 by the communication time Td cannot be caused tocorrespond to a total period from the first timing to the referencetiming and the position of the robot 12 immediately before the referencetiming cannot be calculated. In this regard, in the embodiment, sincethe period at which the data processing unit 63 acquires position datafrom the encoders is the control period T larger than the communicationtime Td, it is possible to cause the straight line 82 obtained bytranslating the straight line 81 by the communication time Td in FIG. 6to correspond to the total period from the first timing to the referencetiming. As a result, it is possible to surely calculate the position ofthe robot 12 at the time of the detection of the trigger signal.

(7) In the robot system 10, it is possible to correct the targetposition of the robot 12 while moving the workpiece W. In other words,it is unnecessary to stop the robot 12 in order to acquire a correctionamount of the target position. As a result, it is possible to suppressthe throughput of the robot system 10 from decreasing.

(8) Moreover, the target position of the robot 12 is corrected on thebasis of the actual position of the robot at the time of the detectionof the trigger signal. Consequently, it is possible to arrange theworkpiece W in the predetermined position on the workbench 15 at highaccuracy.

The embodiment can also be appropriately changed and carried out asexplained below.

As in the embodiment, the position calculating unit 60 can be applied toa robot system that detects the position of a robot while moving therobot.

As explained above, in the robot system, it is extremely rare that theposition data will continue to be determined to be abnormal. Therefore,the position calculating unit 60 according to the embodiment isconfigured on the premise that at least one of two position datacontinuously acquired from the same encoder is normal position data.However, this configuration may be changed. The position calculatingunit 60 may be configured on the assumption that abnormal position dataare continuously input.

For example, in the data processing unit 63, a counter that counts,concerning position data at the first timing and position data at thesecond timing, the number of times an abnormality of the position datacontinues is provided for each of the control axes C1 to C4. The dataprocessing unit 63 stores, as the position data at the first timing,normal position data acquired last time until normal position data isacquired. When normal data is acquired for the first time at a timinglater than the reference timing as the position data at the secondtiming, the data processing unit 63 updates the second position to theposition data. Under such a configuration, the data processing unit 63calculates, on the basis of count values of the counters, a period fromthe first timing to the reference timing and a period from the referencetiming to the second timing. It is desirable to perform linearinterpolation on the basis of the calculated periods, the normalposition data at the first timing, and the normal position data at thesecond timing and calculate the position of the robot 12 at the time ofthe detection of the trigger signal.

With the configuration explained above, when abnormal data arecontinuously acquired, it is possible to end the series of processingassuming that the accuracy of a calculated position of the robot 12 islow on the basis of count values of the counters. It is also possible tourge maintenance of the robot 12 by notifying a user that the abnormalposition data are continuously acquired.

The position calculating unit 60 according to the embodiment may beconfigured not to calculate the position of the robot 12 at the time ofthe detection of the trigger signal when it is determined that positiondata acquired at a timing immediately before or immediately after thereference timing is abnormal.

The position calculating unit 60 according to the embodiment calculatesjoint angles on the control axes C1 to C4 respectively on the basis ofposition data input from the encoders having detection targets differentfrom one another. However, the position calculating unit 60 is notlimited to this. In the embodiment, for example, the positioncalculating unit 60 may calculate only a joint angle on the control axisC1 and a joint angle on the control axis C2. With such a configuration,since joint angles related to an X axis direction and a Y axis directionin the target position of the robot 12 are corrected, when workpiecesuch as disc-like workpiece is arranged, it is possible to reduce a loadon the position calculating unit 60 if the direction of the workpiece isnot regarded as important.

The trigger-signal input unit 61 according to the embodiment isconfigured to be capable of detecting the trigger signal at thedetection period Ts (=T/n) obtained by dividing the control period T forthe motors with the number of control axes n (n is an integer equal toor larger than 1, in this embodiment, n=4). However, the trigger-signalinput unit 61 is not limited to this. The trigger-signal input unit 61may be configured to be capable of detecting the trigger signal at aperiod shorter than the period T/n. With such a configuration, it ispossible to reduce a difference between time the workpiece W is detectedby the detection sensor 35 and time the trigger signal is detected bythe data processing unit 63. Therefore, it is possible to more highlyaccurately calculate the position of the robot 12 at the time of thedetection of the trigger signal. The trigger-signal input unit 61 may beconfigured to be capable of detecting the trigger signal at a periodlonger than the period T/n. With this configuration, the differencebetween the time the workpiece W is detected by the detection sensor 35and time the trigger signal is detected by the data processing unit 63is larger than that in the configuration explained above. The accuracyof a calculated position of the robot 12 is deteriorated. However, sincethe position of the robot 12 is calculated by the linear interpolationtaking into account the communication time Td, it is possible to obtaina position closer to an actual position than a position obtained in theconfiguration for detecting the position of the robot 12 only with theposition data from the encoders.

The position calculating unit 60 according to the embodiment calculatesjoint angles at the time of the detection of the trigger signal afterdetermining whether the position data input from the encoders arenormal. However, the position calculating unit 60 is not limited tothis. The position calculating unit 60 may calculate joint angleswithout determining whether the position data are normal, for example,as long as reliability of the position data is sufficiently guaranteed.With such a configuration, since it is possible to omit the determiningunit 68 of the position-data input unit 62, it is possible to furthersimplify the configuration of the position calculating unit 60.

The position calculating unit 60 according to this embodiment takes theopportunity of the detection of the trigger signal to calculate theposition of the robot 12 at the time of the detection of the triggersignal. However, the position calculating unit 60 is not limited tothis. For example, a timer that takes the opportunity of gripping of theconveyed workpiece W to start time measurement may be provided in theposition calculating unit 60 to detect the position of the robot 12 whena predetermined time elapses after the workpiece W is gripped. In otherwords, a command for detecting the position of the robot 12 is notlimited to be input from outside of the position calculating unit 60.The position calculating unit 60 may be configured to generate thecommand on the inside thereof on the basis of a control program set inadvance.

In the embodiment, the timing immediately after the detection of thetrigger signal is set as the reference timing based on the input of thetrigger signal. However, the reference timing is not limited to this.The reference timing should merely be a timing specified by thedetection of the trigger signal. For example, the detection time of thetrigger signal may be set as the reference timing.

In the embodiment, the position calculating unit 60 functioning as therobot-position detecting device is embodied in the robot system 10including the robot 12 of the horizontal multi-joint type having thefour control axes. However, the robot-position detecting device is notlimited to this. The robot-position detecting device can be embodied ina robot system including a robot that conveys the workpiece W. Forexample, the robot-position detecting device may be embodied in a robotsystem including a multi-joint robot having six control axes. Further,the terms grip and gripping do not necessarily mean grasped and includeany ability to retain.

The entire disclosure of Japanese Patent Application No. 2011-047863,filed Mar. 4, 2011 is expressly incorporated by reference herein.

What is claimed is:
 1. A robot-position detecting device comprising: aposition-data acquiring unit that acquires position data indicatingactual positions of a robot; a position-data input unit that receivesthe position data output from the position-data acquiring unit; and aposition calculating unit that calculates a computational position ofthe robot through linear interpolation using first and second positiondata input to the position-data input unit at different times, whereinthe position-data acquiring unit is an encoder provided in the robot;the position calculating unit receives a command for detecting aposition of the robot and calculates the computational position of therobot; the first position data is data acquired at a timing earlier thanthe command; the second position data is data acquired at a timing laterthan the command; and the position calculating unit includes a commanddetecting unit that detects the command at a period Ts shorter than apredetermined period T for acquiring the position data input to theposition-data input unit from one encoder.
 2. The robot-positiondetecting device according to claim 1, wherein the position calculatingunit acquires position data from different encoders at each period T/nobtained by equally dividing the predetermined period T by an integer nequal to or larger than 1 and outputs, for each of the encoders, aposition of the robot at the time the command is input.
 3. Therobot-position detecting device according to claim 1, wherein theposition calculating unit determines whether the acquired position datais normal and, when the position calculating unit determines that theposition data immediately before the detection of the command is notnormal, the position calculating unit uses, as the first data, positiondata acquired immediately before the not normal position data wasacquired.
 4. The robot-position detecting device according to claim 3,wherein, when the position calculating unit determines that the positiondata immediately after the detection of the command is not normal, theposition calculating unit uses, as the second position data, positiondata acquired immediately after the not normal position data wasacquired.
 5. A robot system comprising: a robot that conveys aworkpiece; and a robot controller including a command output unit thatoutputs a command for detecting a position of the robot, the robotcontroller causing the robot to act, wherein the robot system includesthe robot-position detecting device according to claim
 1. 6. A robotsystem comprising: a robot that conveys a workpiece; and a robotcontroller including a command output unit that outputs a command fordetecting a position of the robot, the robot controller causing therobot to act, wherein the robot system includes the robot-positiondetecting device according to claim
 2. 7. The robot system according toclaim 5, further comprising: a camera that picks up, at a time when thecommand is input from the command output unit, an image of apredetermined image pickup range that includes the workpiece as it isbeing moved to a target position by the robot; a workpiece-positionacquiring unit that acquires the position of the workpiece based on theimage acquired by the camera; and a target-position correcting unit thatcorrects the target position based on the position of the workpieceacquired by the workpiece-position acquiring unit and the computationalposition of the robot calculated by the robot-position detecting device.8. The robot system according to claim 6, further comprising: a camerathat picks up, at a time when the command is input from the commandoutput unit, an image of a predetermined image pickup range thatincludes the workpiece as it is being moved to a target position by therobot; a workpiece-position acquiring unit that acquires the position ofthe workpiece based on the image acquired by the camera; and atarget-position correcting unit that corrects the target position basedon the position of the workpiece acquired by the workpiece-positionacquiring unit and the computational position of the robot calculated bythe robot-position detecting device.